function commomStr(str1, str2) {
    let result = ""
    for (let i = 0; i < str1.length; i++) {
        if (str1[i] === str2[i]) {
            result += str1[i]
        } else {
            return result
        }
    }
    return result
}

console.log(commomStr("jiaow", "jeao"))